<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>客户管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		$("#yincang").hide();//div隐藏

		$(".status").change(function() {
			var todayid = $(".todayid").val();
			var todaycontent = $("input[name=content]").val();

			$.ajax({
				type : "post",
				url : '${ctx}/crm/todaycustomer/todayCalendar/status',
				data : {
					Calendarid : todayid,
					content : todaycontent
				},
				success : function(data) {
					window.location.reload();
				}
			});
		});
	});

	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}

	function tanchu(customerId) {
		$("#yincang").show();
		$(".shade").show();
	}

	function change() {
		$("#yincang").hide();
		$(".shade").hide();
	}

	/* 展示添加地址弹框 */
	/* function showAddAddress(customerId) {
		
		

	} */
	/* function cancelAddAddress() {
		$(".shade").hide();
		$(".addAddress").hide();
	} */
</script>

<style type="text/css">
#yincang {
	position: fixed;
	width: 80%;
	height: 80%;
	top: 10%;
	left: 10%;
}

.shade {
	display: none;
	width: 100%;
	height: 100%;
	background: black;
	position: fixed;
	z-index: 998;
	opacity: 0 .5;
	filter: alpha(opacity =    50);
	/* ie 有效*/
	-moz-opacity: 0.5; /* Firefox  有效*/
	opacity: 0.5;
	width: 100%;
	filter: alpha(opacity =    50); /* 通用，其他浏览器  有效*/
}

.yincang {
	z-index: 999;
}
</style>
</head>
<body>
	<div class="shade"></div>
	<ul class="nav nav-tabs">
		<li class="active">
			<a href="javascript:void(0)">今日联系客户列表</a>
		</li>
		<shiro:hasPermission name="workbench:todayCalendar:edit">
			<li>
				<a href="${ctx}/crm/workbench/todayCalendar/form">客户添加</a>
			</li>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="todayCalendar" action="${ctx}/crm/workbench/todayCalendar/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />

	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th width="6%">开始时间</th>
				<th width="6%">结束时间</th>
				<th width="20%">客户</th>
				<th width="50%">内容</th>
				<th width="6%">状态</th>
				<th width="7%">联系人</th>
				<th width="5%">操作</th>
				<shiro:hasPermission name="workbench:todayCalendar:edit">
					<th>操作</th>
				</shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="todayCalendar">
				<tr>
					<td>
						<fmt:formatDate value="${todayCalendar.beginTime}" pattern="HH:mm" />
					</td>
					<td>
						<fmt:formatDate value="${todayCalendar.endTime}" pattern="HH:mm" />
					</td>
					<td>
						<a id="cuname" target="customerInfo" href="${ctx}/crm/findcustomer/findCustomer/form?id=${todayCalendar.customerId}" onclick="tanchu('${todayCalendar.customerId}')">${todayCalendar.cuname}</a>
					</td>
					<td>
						<%-- <input type="text" name="content" value="${todayCalendar.content}"> --%>
						<%-- ${todayCalendar.content} --%>
						<div style="width: 600px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;" title="${todayCalendar.content}">${todayCalendar.content}</div>
					</td>
					<td>
						<c:if test="${todayCalendar.status=='未完成'}">
							<select class="status">
								<option value="未完成">未完成</option>
								<option value="已完成">已完成</option>
							</select>
						</c:if>
						<c:if test="${todayCalendar.status=='已完成'}">
				${todayCalendar.status}
				</c:if>
					</td>
					<td>
						<a href="${ctx}/crm/business/hycrmContact/formChange?id=${todayCalendar.contactId}"> ${todayCalendar.ctname} </a>
					</td>
					<td>
						<a href="${ctx}/crm/findcustomer/findCustomer/form?id=${todayCalendar.customerId}">客户详情</a>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>

	<div id="yincang" class="yincang" align="right">
		<div style="width:100%; background: #C3C3C3;">
			<a href="javascript:void(0)" onclick="change()">
				<img style="background: red;" width="25px" src="${ctxStatic}/businessImg/exit.png">
			</a>
		</div>
		<iframe style="border:0;width: 100%; height: 100%;" name="customerInfo"> </iframe>
	</div>

	<br />
	<c:if test="${empty page.list}">
		<p style="font-size: 20px; width: 350px; margin: 0px auto;">暂无今日联系客户</p>
	</c:if>
</body>
</html>